package com.design.interpreter;

/**
 * @author leali
 * @title: ActionNode
 * @projectName design
 * @description: 动作解释：终结符表达式
 * @date 2022/1/3 18:19
 */
public class ActionNode extends AbstractNode{
    private final String action;

    public ActionNode(String action) {
        this.action = action;
    }

    @Override
    public String interpret() {
        if ("move".equalsIgnoreCase(action)) {
            return "移动";
        }
        else if ("run".equalsIgnoreCase(action)) {
            return "快速移动";
        }
        else {
            return "无效指令";
        }
    }
}
